package cn.com.aiouyi.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name="t_file")
public class File extends BaseEntity<Long>{

	/** 文件的名称 */
	private String name;
	
	/** 原始的名称 */
	private String originName;
	
	/** 文件 */
	@ManyToOne
	private Accessory acc;
	
	/** 文件分类 */
	@ManyToOne
	private FileClass fileClass;
	
	/** @Fields 是否置顶*/
	@Column(columnDefinition="bit default false")
	private Boolean top;
	
	/** 下载次数 */
	@Column(columnDefinition = "int default 0")
	private Integer downloadCount;
	
	/** @Fields 是否在前台显示*/
	@Column(columnDefinition="bit default true")
	private Boolean display;

	public Boolean equalClass(FileClass fileClass){
		if (this.fileClass.equals(fileClass)){
			return true;
		}
		return false;
	}
}
